Copyright(C) 1994,1995,1996,1997 Terumasa KODAKA , Takeshi KONO


■APIC (Advanced Programmable Interrupt Controller)

Target           Multiprocessor Machines
                 Pentium processors with 75MHz or higher
Explanation    o APIC is an interrupt controller for 32-bit OS, and handles
                 interrupts in a multiprocessor environment.
               o APIC is used in one local unit for each CPU, and in the I/O unit that
                 manages interrupts from I/O. (Figure 1)
               o Currently, there are no models in the PC-9800 series that have this APIC
                 (82489DX) installed as an I/O unit, but the Pentium processors (P54C, P55C)
                 with 75MHz or higher have a local APIC built into the CPU.
               o The APIC function is not currently used in the PC-9800 series.
               o You can determine whether a CPU has a local APIC by executing the CPUID
                 command with EAX=00000001h and checking whether bit 9 of the value obtained in
                 the EDX register is 1.
               u When CPUID is 0521h, 0522h, or 0524h, in the P54C, you can disable the local
                 APIC built into the CPU by setting bit 4 of the TR12 register to 1.

                 Figure 1: Local Unit and I/O Unit
                 ---------------------------------------------------------------------

                    +----------+     +----------+     +----------+
                    |Processor |     |Processor |     |Processor |
                    +----+-+---+     +----+-+---+     +----+-+---+
                         | |              | |              | |
                 Register| |PINT  Register| |PINT  Register| |PINT
                  Access | |PNMI   Access | |PNMI   Access | |PNMI
                         | |              | |              | |
                   +-----+-+----+   +-----+-+----+   +-----+-+----+
                   |APIC 82489DX|   |APIC 82489DX|   |APIC 82489DX|
                   |Local       |   |Local       |   |Local       |
                   |        Unit|   |        Unit|   |        Unit|
                   +------+-----+   +------+-----+   +------+-----+
                          |                |                |
                          |                |                |         ICC bus
                  ←-------+----------------+-------+--------+------------→
                                                   |
                                                   |ID=0
                           +-----------+    +------+-----+
                           |Various I/O+----|APIC 82489DX|
                           +-----------+    |  I/O unit  |
                                            +------------+

                 ---------------------------------------------------------------------

               o The APIC is usually accessed by memory-mapped I/O. The local unit is mapped
                 to FEE00000h in the memory space. The I/O unit is mapped to FEC00000h. If
                 there are multiple I/O units, each APIC is mapped as shown in Table 1.

                 Table 1: I/O Unit Mapping Address
                 --------+-----------------------
                 Number  | Address
                 --------+-----------------------
                 #0      | FEC00000h~
                 #1      | FEC01000h~
                 #2      | FEC02000h~
                 :       | :
                 :       | :
                 --------+-----------------------

                 Table 2: I/O Unit Register 1
                 ---------------+-----+------------------------------------
                 Address [9:4]  | R/W | Register Name
                 ---------------+-----+------------------------------------
                 00 0000b       |WRITE| I/O Register Select
                 00 0001b       | R/W | I/O Windows Register
                 ---------------+-----+------------------------------------

                 Table 3: I/O Unit Register 2
                 ---------------+-----+------------------------------------
                 Address[7:0]   | R/W | Register Name
                 ---------------+-----+------------------------------------
                 00000000b      | R/W | I/O Unit ID Register
                 00000001b      |READ | Version Register
                 00010000b      | R/W | Redirection Table[0](31:0)
                 00010001b      | R/W | Redirection Table[0](63:32)
                 00010010b      | R/W | Redirection Table[1](31:0)
                 00010011b      | R/W | Redirection Table[1](63:32)
                 00010100b      | R/W | Redirection Table[2](31:0)
                 00010101b      | R/W | Redirection Table[2](63:32)
                 00010110b      | R/W | Redirection Table[3](31:0)
                 00010111b      | R/W | Redirection Table[3](63:32)
                 00011000b      | R/W | Redirection Table[4](31:0)
                 00011001b      | R/W | Redirection Table[4](63:32)
                 00011010b      | R/W | Redirection Table[5](31:0)
                 00011011b      | R/W | Redirection Table[5](63:32)
                 00011100b      | R/W | Redirection Table[6](31:0)
                 00011101b      | R/W | Redirection Table[6](63:32)
                 00011110b      | R/W | Redirection Table[7](31:0)
                 00011111b      | R/W | Redirection Table[7](63:32)
                 00100000b      | R/W | Redirection Table[8](31:0)
                 00100001b      | R/W | Redirection Table[8](63:32)
                 00100010b      | R/W | Redirection Table[9](31:0)
                 00100011b      | R/W | Redirection Table[9](63:32)
                 00100100b      | R/W | Redirection Table[10](31:0)
                 00100101b      | R/W | Redirection Table[10](63:32)
                 00100110b      | R/W | Redirection Table[11](31:0)
                 00100111b      | R/W | Redirection Table[11](63:32)
                 00101000b      | R/W | Redirection Table[12](31:0)
                 00101001b      | R/W | Redirection Table[12](63:32)
                 00101010b      | R/W | Redirection Table[13](31:0)
                 00101011b      | R/W | Redirection Table[13](63:32)
                 00101100b      | R/W | Redirection Table[14](31:0)
                 00101101b      | R/W | Redirection Table[14](63:32)
                 00101110b      | R/W | Redirection Table[15](31:0)
                 00101111b      | R/W | Redirection Table[15](63:32)
                 ---------------+-----+------------------------------------

                 Table 4: Local Unit Registers
                 ---------------+-----+------------------------------------
                 Address[9:4]   | R/W | Register Name
                 ---------------+-----+------------------------------------
                 000010b        | R/W | Local Unit ID Register
                 000011b        |READ | Version Register
                 000100b        |     | Reserved
                 000101b        |     | Reserved
                 000110b        |     | Reserved
                 000111b        |     | Reserved
                 001000b        | R/W | Task Priority Register
                 001001b        |     | Reserved
                 001010b        |     | Reserved
                 001011b        | R/W | EOI Register
                 001100b        |READ | Remote Register
                 001101b        | R/W | Logical Destination Register
                 001110b        | R/W | Destination Format Register
                 001111b        | R/W | Spurious Vector Register
                 010000b        |READ | ISR(31:0)
                 010001b        |READ | ISR(63:32)
                 010010b        |READ | ISR(95:64) 
                 010011b        |READ | ISR(127:96)
                 010100b        |READ | ISR(159:128)
                 010101b        |READ | ISR(191:160)
                 010110b        |READ | ISR(223:192)
                 010111b        |READ | ISR(255:224)
                 011000b        |READ | TMR(31:0)
                 011001b        |READ | TMR(63:32)
                 011010b        |READ | TMR(95:64)
                 011011b        |READ | TMR(127:96)
                 011100b        |READ | TMR(159:128)
                 011101b        |READ | TMR(191:160)
                 011110b        |READ | TMR(223:192)
                 011111b        |READ | TMR(255:224)
                 100000b        |READ | IRR(31:0)
                 100001b        |READ | IRR(63:32)
                 100010b        |READ | IRR(95:64)
                 100011b        |READ | IRR(127:96)
                 100100b        |READ | IRR(159:128)
                 100101b        |READ | IRR(191:160)
                 100110b        |READ | IRR(223:192)
                 100111b        |READ | IRR(255:224)
                 101000~101111b|     | Reserved
                 110000b        | R/W | Interrupt Command Register(31:0)
                 110001b        | R/W | Interrupt Command Register(63:32)
                 110010b        | R/W | Local Vector Table[Timer]
                 110011b        |     | Reserved
                 110100b        |     | Reserved
                 110101b        | R/W | Local Vector Table[Local int 0]
                 110110b        | R/W | Local Vector Table[Local int 1]
                 110111b        |     | Reserved
                 111000b        | R/W | Initial Count Register
                 111010b        |READ | Current Count Register
                 111011b        |     | Reserved
                 111100b        |     | Reserved
                 111101b        |     | Reserved
                 111110b        | R/W | Divider Configuration Register
                 111111b        |     | Reserved
                 ---------------+-----+------------------------------------